Internet use has increased dramatically over the past five years. Both the number of users connecting to the Internet and applications requiring greater bandwidth have created the need to increase network bandwidth. Consequently, network designers are migrating to higher speed backbones, such as Gigabit Ethernet, to compensate for increased network traffic. Higher speed backbones place greater demands on network switching performance because network switches must complete data packet processing more efficiently if data packets are to be switched at higher rates.
In a packet switched network, network traffic consists of data packets that move from one network node to another. A node is any computer, printer, router, switch, gateway, or other device attached to the network. A network switch directs a data packet from one node to the next by reading information contained in the data packet header. Frequently, the network switch modifies one or more fields of the data packet header to complete this routing. This is especially true if the data packet crosses network domain boundaries or if the network switch performs operations such as load balancing or packet prioritization.
For a network switch to route a data packet properly, the structure of the data packet must conform to the protocol of the network. A computer that places information on the Internet generally complies with the Open System Interconnection (OSI) model where the protocol is divided into seven layers. Information that is sent from one computer to the next is normally generated in the Application layer (layer 7) of the source node by the user or software. The information is then sent to the Presentation layer (layer 6) where it is translated into a format that can be read by the destination node. Once translated, the information is then queued in the Session layer (layer 5) for managed control of the transmission. The Transport layer (layer 4), which receives the information from the Session layer, ensures that the data packet is successfully transferred between the two end nodes. The Network layer (layer 3) provides routing information for the data packet. The Data Link layer (layer 2), which includes the Media Access Control (MAC) sub-layer, monitors activity on the network before sending a data packet, recognizes boundaries between data packets, and regulates the flow of data packets between nodes. The Physical layer (layer 1) comprises the hardware that generates the actual signals that are transmitted through the physical medium of the connection, such as the wires of an Ethernet connection.
To accomplish their functions, the Transport, Network, and Data Link layers encapsulate data with header information, which originates in the Application layer before the data is placed on the network. Each layer appends its information to the front of the information passed to it from the prior layer, thereby encapsulating the information from the prior layer. The result is a data packet that contains data and layers of encapsulated header information.
Because a data packet contains layers of encapsulated information, the type of switching performed by a network switch depends upon the layer of information processed. A layer 2 switch forwards a data packet based upon the physical address of the destination node found in header information supplied by the MAC sub-layer of the Data Link layer. Because layer 2 switching usually occurs in hardware, it operates very quickly and is an efficient means of handling network transmissions within local area networks (LANs).
A network switch configured for layer 3 processing (usually referred to as a router) processes information added by the Network Layer. In an Internet Protocol (IP) based network, the layer 3 switch uses information from the IP header to calculate routes based upon logical addresses, such as IP addresses, rather than physical addresses.
Layer 4 network switches process information supplied by the Transport Layer. In the Internet environment, the Transport Layer includes Transmission Control Protocol (TCP) segments and/or Universal Data Protocol (UDP) datagrams. A layer 4 network switch uses information, such as port numbers, protocol bits, and IP source and destination addresses, to move network traffic across the Internet. Load balancing and prioritization of certain data traffic, such as Voice over IP, are two examples of the types of functions that require layer 4 processing.
A network switch configured for layer 4 processing oftentimes modifies one or more fields of the IP, TCP, or UDP header to complete routing. For example, a data packet that crosses from one Internet domain to the next may undergo Network Address Translation (NAT). NAT allows IP addresses to be reused across Internet domains, thus reducing the problem of IP address depletion. To translate IP addresses, a network switch must modify an IP source or destination address of the IP header before forwarding the data packet to its next hop. Because the checksum value contained in the IP header is calculated over packet fields including the IP source and destination fields, the header checksum must also be modified.
However, re-calculating a header checksum while maintaining switching performance requires substantial computational resources, especially if the network data packet contains a TCP segment or UDP datagram because the TCP or UDP checksum is calculated over both its header and data (payload) fields and the payload may be thousands of bytes long. To re-compute a TCP or UDP checksum, a network switch can buffer the entire TCP segment or UDP datagram, modify the header information, re-calculate the checksum, and forward the data packet before the next data packet is received. Although a buffering approach is useful in some situations, it can require lots of memory and may slow the performance of a switch.
One way to increase network switch performance is to configure the switch to update the header checksum incrementally over a portion of the TCP or UDP packet rather than by re-computing it over the entirety of the packet. Incremental update takes advantage of the additive properties of checksum calculation by adding and subtracting values to the original header checksum based upon the changes made to the data packet header. These short calculations eliminate the need to buffer and re-calculate the checksum over the entire packet. The details of incrementally updating the IP checksum can be found in the Internet Engineering Task Force RFC 1141 entitled “Incremental Updating of the Internet Checksum” and RFC 1624 entitled “Computation of the Internet Checksum via Incremental Update.” The details of calculating an Internet checksum can be found in RFC 1071 entitled “Computing the Internet Checksum.” All three titles are incorporated by reference herein.
Although RFC 1141 and 1624 provide an improved technique for computing TCP/UDP checksums, these specifications do not fully realize the performance improvement available using incremental checksum computations. Accordingly, there is a need for an improved approach for incrementally calculating TCP and UDP checksums.